<?php 
  require_once(DIR_WS_CLASSES.'class.products_filter.php');
  $filter = new products_filter();
  if (!isset($_GET['ct']))
    $content = '';
  else {
      
    $price_bounds = $filter->get_price_bounds($_GET['ct']);
    $min_val=floor($price_bounds['min']);
    $max_val=ceil($price_bounds['max']);
  
    if(isset($_GET['minp'])&&!empty($_GET['minp']))
      $min_price=$_GET['minp'];
    elseif(isset($_SESSION['products_filters']['min_price']))
      $min_price=$_SESSION['products_filters']['min_price'];
    else 
      $min_price=$min_val;
    
    if(isset($_GET['maxp'])&&!empty($_GET['maxp']))
      $max_price=$_GET['maxp'];
    elseif(isset($_SESSION['products_filters']['min_price']))
      $max_price=$_SESSION['products_filters']['max_price'];
    else 
      $max_price=$max_val;
      
    $cur=$price->currencies[$price->actualCurr]['symbol_right'];
    $content = ';$(function(){$("#filter-range").slider({range:true,min:'.$min_val.',max:'.$max_val.',steps:'.$max_val.',values:['.$min_price.','.$max_price.'],slide:function(a,b){$("#price_range").html(b.values[0]+" '.$cur.' - "+b.values[1]+" '.$cur.'");$("#val_1").val(b.values[0]);$("#val_2").val(b.values[1])}});$("#price_range").html(" " + $("#filter-range").slider("values",0)+" '.$cur.' - "+$("#filter-range").slider("values",1)+" '.$cur.'");$("#val_1").val('.$min_price.');$("#val_2").val('.$max_price.');$(".filter_item").click(function(){if(!$(this).is(":checked")){$("input."+$(this).attr("id")).attr("checked",false);}$("#filter_child_"+$(this).attr("id")).fadeToggle();});$(".filter_sub_items input").click(function(){var check=0;var name=$(this).attr("class");$("input."+name).each(function(){if($(this).is(":checked")){check++;}});if(check==0){$("#"+name).attr("checked",false);$("#ul_"+name).fadeToggle();}});$(".delete_filter").click(function(){$(".filter_item").each(function(){$(this).attr("checked",false);});$(".filter_sub_item").each(function(){$(this).attr("checked",false);});});});';
  }